package com.captain.special.链表;

/**
 * Des:
 *
 * @author XL
 * @Date 2022/3/24 9:41
 */
public class Node {
    int val;
    Node next;
    Node random;

    public static Node gentInstance() {

        Node node1 = new Node(1);
        Node node2 = new Node(13);
        Node node3 = new Node(11);
        Node node4 = new Node(10);
        Node node5 = new Node(1);

        node1.next = node2;
        node1.random = null;
        node2.next = node3;
        node2.random = node1;
        node3.next = node4;
        node3.random = node5;
        node4.next = node5;
        node4.random = node3;
        node5.next = null;
        node5.random = node1;
        return node1;
    }

    public Node(int val) {
        this.val = val;
        this.next = null;
        this.random = null;
    }

    public int getVal() {
        return val;
    }

    public void setVal(int val) {
        this.val = val;
    }

    public Node getNext() {
        return next;
    }

    public void setNext(Node next) {
        this.next = next;
    }

    public Node getRandom() {
        return random;
    }

    public void setRandom(Node random) {
        this.random = random;
    }
}
